#include <iostream>
#include<algorithm>
#include<string>
using namespace std;

int countAppearance(string str, char parttern) {
	int sum = 0;
	parttern = tolower(parttern);
	for (auto &item : str) {
		if (parttern == tolower(item))
			sum++;
	}
	return sum;

}

int main() {
	string str;
	getline(cin, str);
	char target;
	cin >> target;
	int res = countAppearance(str, target);
	cout << res;
}
